package ru.st.selenium.applogic2;

import java.util.ArrayList;
import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.TimeoutException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.Assert;

import ru.st.selenium.applogic.CollectionPageHelper;
import ru.st.selenium.model.Film;


public class CollectionPageHelper2 extends DriverBasedHelper implements CollectionPageHelper {

	
	 public CollectionPageHelper2(ApplicationManager2 manager) {
		    super(manager.getWebDriver());
		  }
	
	  
	  @Override
	  public void addNewMovie(){
		  		  
		  pages.collectionPage
		  .ensurePageLoaded()
		  .clickToAddMovie();
	  }
	  
	 @Override 
	 
	 public boolean searchFilm(Film film) {
		 
		if(pages.collectionPage.ensurePageLoaded().searchFilm(film.getTitle())!=null)
		 
		 return true;
		
		else 
			
		return false;
	 }
	 
	 @Override
	 
	 public boolean deleteMovie(Film film){
		 
		 if(pages.collectionPage
				 .ensurePageLoaded()
				 .deleteMovie(film))
		 return true;
				 
		 else
			 return false;
	 }

	
}
